package org.footballmanager.pandafootball.system.form.impl;

import lombok.Getter;
import lombok.Setter;
import org.footballmanager.pandafootball.system.domain.FootChip;
import org.footballmanager.pandafootball.system.form.SearchForm;
import tk.mybatis.mapper.entity.Example;

import java.io.Serializable;

@Getter
@Setter
public class FootChipSearchForm extends SearchForm implements Serializable {
    private static final long serialVersionUID = 8090668615941861523L;
    protected String userName;
    protected Long haveWhile;
    protected Long haveGreen;
    protected Long haveBlue;
    protected Long havePurple;
    protected Long haveOrange;
    protected Long userId;

    public Example buildSearchCommond() {
        Example example = new Example(FootChip.class);
        Example.Criteria criteria = example.createCriteria();
        if (haveWhile != null) {
            criteria.andEqualTo("haveWhile", haveWhile);
        }
        if (haveGreen != null) {
            criteria.andEqualTo("haveGreen", haveGreen);
        }
        if (haveBlue != null) {
            criteria.andEqualTo("haveBlue", haveBlue);
        }
        if (havePurple != null) {
            criteria.andEqualTo("havePurple", havePurple);
        }
        if (haveOrange != null) {
            criteria.andEqualTo("haveOrange", haveOrange);
        }
        if (userId != null) {
            criteria.andEqualTo("userId", userId);
        }
        criteria.andEqualTo("delFlag", 0);
        return example;
    }

}
